import React from 'react';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { message } from 'antd';
import { connect } from 'dva';
import moment from 'moment';
import { FormGroup, DATA_ENTRY, SecondHeaderC, ThreeHeaderC, FixedButtonC, PrimaryGhostC, PrimaryC } from '../../../../comps';
import { getUserInfo } from '../../../../utils/commonFunc';
import ExtensionList from './ExtensionList';
import AccountList from './AccountList';
import styles from '../index.less';

@Form.create()
class BaseInfo extends React.Component {
  constructor() {
    super();
    this.state = {
      otherHeight: '130px',
      formDatas: {
        baseInfo: {}, // 基本信息total
      },
      startDate: undefined,
      endDate: undefined,
      productStartTime: '', // 产品起始日
      status: '3',
      showExpend: false, // 账户信息内容展开收起
      modesValue: '', // 交易模式
      cpyzms: '', // 运作模式
      options: [], // 下拉框
      value: '',
      productGroupIds: [],
      isDkProduct: 'false', // 是否定开产品
      openCycle: '', // 开放周期
      financialEndDate: undefined, // 财务结束日
      // tooltipDataSource: sessionStorage.getItem('allProductGroupIds') ? JSON.parse(sessionStorage.getItem('allProductGroupIds')) : undefined,
    };
  }

  componentDidMount() {
    // const { dispatch } = this.props;
    this.getOptions();
    !sessionStorage.getItem('allProductGroupIds') && this.getAllOptions(); // 缓存里没有才去取
    this.props.onRef && this.props.onRef(this.self.child);
    const {
      formDatas: { baseInfo },
    } = this.props;
    this.setState({
      formDatas: {
        baseInfo, // 基本信息
      },
      startDate: baseInfo?.startDate,
      endDate: baseInfo?.endDate,
      financialEndDate: baseInfo?.financialEndDate,
      productStartTime: baseInfo?.startDate, // 产品起始日
      status: baseInfo?.status ? baseInfo?.status : '3',
      modesValue: baseInfo?.modes,
      cpyzms: baseInfo?.baxx_cpyzms,
      productGroupIds: (baseInfo?.productGroup || []).map((i) => i.id),
      isDkProduct: baseInfo?.isDkProduct,
      openCycle: baseInfo?.openCycle,
    });
    if (
      (baseInfo?.accountList0 && baseInfo?.accountList0.length > 0) ||
      (baseInfo?.accountList1 && baseInfo?.accountList1.length > 0) ||
      (baseInfo?.accountList2 && baseInfo?.accountList2.length > 0)
    ) {
      this.setState({
        showExpend: true,
      });
    }
  }

  UNSAFE_componentWillReceiveProps(nextPorps) {
    if (JSON.stringify(nextPorps.formDatas) != JSON.stringify(this.props.formDatas)) {
      const baseInfo = nextPorps.formDatas?.baseInfo;
      this.setState({
        formDatas: {
          baseInfo, // 基本信息
        },
        startDate: baseInfo?.startDate,
        endDate: baseInfo?.endDate,
        financialEndDate: baseInfo?.financialEndDate,
        productStartTime: baseInfo?.startDate, // 产品起始日
        status: baseInfo?.status ? baseInfo?.status : '3',
        modesValue: baseInfo?.modes,
        cpyzms: baseInfo?.baxx_cpyzms,
        productGroupIds: baseInfo?.productGroup,
        isDkProduct: baseInfo?.isDkProduct,
        openCycle: baseInfo?.openCycle,
      });
      if (
        (baseInfo.accountList0 && baseInfo.accountList0.length > 0) ||
        (baseInfo.accountList1 && baseInfo.accountList1.length > 0) ||
        (baseInfo.accountList2 && baseInfo.accountList2.length > 0)
      ) {
        this.setState({
          showExpend: true,
        });
      }
    }
  }

  // 获取所属产品组下拉数据
  getOptions = (name, cb) => {
    const { dispatch } = this.props;
    dispatch({
      type: 'productGroupDefinitionM/getData',
      payload: {
        currentPage: 1,
        numInPage: 999,
        ...(name ? { name } : {}),
      },
      callback: (res) => {
        const options = res.dataSource.map((item) => {
          const obj = { value: item.id, title: item.portfolioName };
          if (item.children.length > 0) {
            obj.children = item.children.map((chil) => ({ value: 'chid', title: chil.portfolioName }));
            // obj.children=item.children.map(chil=>({value:chil.id,title:chil.portfolioName}))
          }
          return obj;
        });
        this.setState(
          {
            options,
          },
          () => {
            cb && cb();
          },
        );
      },
    });
    dispatch({
      type: 'productGroupDefinitionM/getCondition',
      payload: {},
    });
  };

  // 获取所属所有产品组下拉数据，给tooltip渲染用
  getAllOptions = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'productGroupDefinitionM/getData',
      payload: {
        currentPage: 1,
        numInPage: 999,
      },
      callback: (res) => {
        const list = res.dataSource?.map((item) => ({ value: item.id, title: item.portfolioName }));
        res.dataSource?.length > 0 && sessionStorage.setItem('allProductGroupIds', JSON.stringify(list));
        this.setState({
          tooltipDataSource: list,
        });
      },
    });
  };

  // 取消
  cancel = () => {
    if (this.props.type == 'workStation') {
      // 非标工作台进入
      this.props.changeFormPage('cancel');
    } else {
      this.props.mainThis.setState({
        pageStatus: '1', // 取消的时候 此时需要定位到表格页面，不做处理
      });
      this.props.parentThis.setState({
        tabClick: '0',
      });
    }
  };

  // 保存
  save = () => {
    const { productGroupIds, isDkProduct, openCycle } = this.state;
    this.validates((val) => {
      if (!val) {
        message.warning('请填写完当前表单，才可以进行保存！');
        return false;
      } else {
        // 保存 调用接口并且 重新刷新下列表页面
        const values = this.bases.props.form.getFieldsValue();
        // 投资信息
        const inves = this.inves.props.form.getFieldsValue();
        if (inves.isDkProduct == '1') {
          inves.isDkProduct = 'true';
        } else {
          inves.isDkProduct = 'false';
        }
        // 运营信息
        const performs = this.perform.props.form.getFieldsValue();
        // 账户信息
        const accountInfos = this.props.form.getFieldsValue();

        if (values?.startDate) {
          values.startDate = moment(values.startDate).format('YYYY-MM-DD');
        }
        if (values?.endDate) {
          values.endDate = moment(values.endDate).format('YYYY-MM-DD');
        }
        if (values?.financialEndDate) {
          values.financialEndDate = moment(values.financialEndDate).format('YYYY-MM-DD');
        }
        let datas = {};
        if (this.props.pageType == 'edit') {
          // 此时是编辑
          datas = {
            baseInfo: {
              ...values,
              ...inves,
              ...performs,
              ...accountInfos,
              id: this.props.productId,
              productGroupIds,
            }, // 基本信息
          };
        } else {
          // 此时是新增
          datas = {
            baseInfo: { ...values, ...inves, ...performs, ...accountInfos, modeType: '2', productGroupIds }, // 基本信息
          };
        }
        this.props.dispatch({
          type: 'productManageM/saveFn',
          payload: {
            // 编辑的话 需要在基本信息中添加一个id
            ...datas,
          },
          callback: (res) => {
            if (res) {
              if (this.props.pageType == 'edit') {
                message.success('编辑成功!');
              } else {
                message.success('新增成功！');
              }
              if (this.props.type == 'workStation') {
                // 非标工作台进入
                this.props.changeFormPage('add');
              } else {
                // 列表页
                this.props.mainThis.setState({
                  pageStatus: '1',
                });
                // 进行刷新
                this.props.dispatch({
                  type: 'productManageM/changeRresh',
                  payload: {
                    status: true,
                  },
                });
              }
            }
          },
        });
      }
    });
  };

  // 校验当前页面必填项
  validates = (callback) => {
    const editabled = this.props.pageType === 'view';
    if (editabled) {
      // 如果是查看
      callback(false);
    } else {
      this.bases.props.form.validateFieldsAndScroll((err1, values1) => {
        this.inves.props.form.validateFieldsAndScroll((err2, values2) => {
          this.perform.props.form.validateFieldsAndScroll((err3, values3) => {
            if (err1 || err2 || err3) {
              callback(false);
            } else {
              callback(true);
            }
          });
        });
      });
    }
  };

  // 产品开始日
  changeProductStartDay = (e) => {
    this.setState({
      productStartTime: e ? moment(e).format('YYYY-MM-DD') : null, // 产品起始日
    });
  };

  changeStatus = (e) => {
    this.setState({
      status: e,
    });
  };

  // j交易模式选择
  changeModes = (e) => {
    this.setState({
      modesValue: e,
    });
  };

  // 账户信息内容展开收起事件
  onExpendClick = (e) => {
    this.setState({
      showExpend: e,
    });
  };

  // 产品运作模式修改
  handleChangeCPYZMS = (e) => {
    this.setState({
      cpyzms: e,
    });
  };

  render() {
    const {
      formDatas: { baseInfo },
      startDate,
      endDate,
      productStartTime,
      status,
      showExpend,
      modesValue,
      cpyzms,
      options,
      openCycle,
      isDkProduct,
      financialEndDate,
    } = this.state;

    const {
      currentUser,
      productManageM,
      form: { getFieldDecorator },
      loading,
      pageType,
      modeType,
    } = this.props;
    const { dictMap, AccountConfigAllowedMarket, TransactionMode, dictMapSelect } = productManageM;
    const editabled = this.props.pageType === 'view'; // 如果是查看的话不展示操作列并且不可以新增
    const listProps = {
      dictMap,
      editabled,
      AccountConfigAllowedMarket,
      TransactionMode,
    };
    const list = [];
    for (const item in TransactionMode) {
      const newItem = {};
      newItem.value = item;
      newItem.title = TransactionMode[item];
      list.push(newItem);
    }
    const user = `${currentUser.name}-${currentUser.userId}`;
    return (
      <div ref={(ref) => (this.parnetRef = ref)}>
        <FixedButtonC
          style={{ borderTop: '1px solid rgba(67, 118, 255, 0.1)' }}
          ref={(ref) => {
            this.self = ref;
          }}
          topHtml={
            <div>
              <SecondHeaderC title='基础信息' />
              <FormGroup
                widthSet={this.props.widthSet}
                dataSource={[
                  {
                    dataIndex: 'name',
                    title: '产品名称',
                    type: DATA_ENTRY.INPUT,
                    initialValue: baseInfo?.name || '',
                    disabled: editabled || pageType == 'edit',
                    rules: [{ required: true, message: '请输入产品名称' }],
                    // span:8
                  },
                  {
                    dataIndex: 'shortName',
                    title: '产品简称',
                    type: DATA_ENTRY.INPUT,
                    initialValue: baseInfo?.shortName || '',
                    disabled: editabled || pageType == 'edit',
                    rules: [{ required: true, message: '请输入产品简称' }],
                    // span:8
                  },
                  {
                    dataIndex: 'gzCode',
                    title: '内部代码',
                    type: DATA_ENTRY.INPUT,
                    disabled: editabled || pageType == 'edit',
                    initialValue: baseInfo?.gzCode || '',
                    rules: [
                      { required: true, message: '请输入内部代码' },
                      { max: 100, message: '字符长度小于100' },
                    ],
                    // span:8
                  },
                  {
                    dataIndex: 'status',
                    title: '产品状态',
                    type: DATA_ENTRY.SELECT,
                    initialValue: baseInfo?.status || '3', // 备案
                    dataSource: dictMapSelect.BAXX_CPZT,
                    rules: [{ required: true, message: '请选择产品状态' }],
                    isMultiple: false,
                    allowClear: true,
                    disabled: editabled,
                    onChange: this.changeStatus,
                    // span:8
                  },
                  {
                    dataIndex: 'code',
                    title: '估值代码',
                    type: DATA_ENTRY.INPUT,
                    disabled: editabled || pageType == 'edit',
                    initialValue: baseInfo?.code || '',
                    rules: [{ required: productStartTime != null && new Date() > new Date(productStartTime), message: '请输入估值代码' }],
                    // span:8
                  },

                  {
                    dataIndex: 'startDate',
                    title: '产品成立日',
                    type: DATA_ENTRY.SINGLEDATE,
                    initialValue: baseInfo?.startDate ? moment(new Date(baseInfo?.startDate)) : null,
                    disableEnd: endDate ? moment(new Date(endDate)) : undefined,
                    disabled: editabled || modeType == '1',
                    allowClear: false,
                    rules: [{ required: status == '0' || status == '5', message: '请输入估值代码' }],
                    onChange: this.changeProductStartDay,
                  },
                  {
                    dataIndex: 'endDate',
                    title: '产品到期日',
                    type: DATA_ENTRY.SINGLEDATE,
                    initialValue: baseInfo?.endDate ? moment(new Date(baseInfo?.endDate)) : null,
                    disableBegin: startDate ? moment(new Date(startDate)) : undefined,
                    disabled: editabled || modeType == '1',
                    allowClear: true,
                  },
                  {
                    dataIndex: 'financialEndDate',
                    title: '财务结束日',
                    type: DATA_ENTRY.SINGLEDATE,
                    initialValue: baseInfo?.financialEndDate ? moment(new Date(baseInfo?.financialEndDate)) : null,
                    // disableBegin: startDate ? moment(new Date(startDate)) : undefined,
                    disabled: editabled || modeType == '1',
                    allowClear: true,
                  },
                  {
                    dataIndex: 'founder',
                    title: '创建人',
                    type: DATA_ENTRY.INPUT,
                    initialValue: this.props.pageType == 'add' ? user : baseInfo?.founder,
                    disabled: true,
                  },
                  getUserInfo().isSuper
                    ? {
                        dataIndex: 'createdBy',
                        title: '产品管理人',
                        type: DATA_ENTRY.TENANT,
                        initialValue: baseInfo?.createdBy || '',
                        disabled: editabled || modeType == '2',
                        rules: [{ required: getUserInfo().isSuper, message: '请选择' }],
                      }
                    : {
                        dataIndex: 'createdBy',
                        title: '产品管理人',
                        type: DATA_ENTRY.INPUT,
                        disabled: true,
                        initialValue: getUserInfo().tenantCHNname || '',
                      },
                  {
                    dataIndex: 'productTrustee',
                    title: '产品托管人',
                    type: DATA_ENTRY.SELECT,
                    showSearch: true,
                    dataSource: dictMapSelect.BAXX_JNTGJGMC,
                    allowClear: true,
                    disabled: editabled,
                    initialValue: baseInfo?.productTrustee || undefined,
                    filterOption: (input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
                  },
                ]}
                autoLayout={true}
                onRef={(ref) => (this.bases = ref)}
              />
              <div className={styles.line}></div>
              <SecondHeaderC title='投资信息' />
              <FormGroup
                onRef={(ref) => (this.inves = ref)}
                widthSet={this.props.widthSet}
                dataSource={[
                  {
                    dataIndex: 'category',
                    title: '产品类别',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.MAAT_PRODUCT_CATEGORY,
                    disabled: editabled,
                    initialValue: baseInfo?.category || undefined,
                    allowClear: true,
                    // span:8
                  },
                  {
                    dataIndex: 'type',
                    title: '产品类型',
                    type: DATA_ENTRY.SELECT,
                    initialValue: baseInfo?.type || undefined,
                    dataSource: dictMapSelect.MAAT_PRODUCT_TYPE,
                    disabled: editabled || modeType == '1',
                    allowClear: true,
                    rules: [{ required: true, message: '请选择产品类型' }],
                    // span:8
                  },
                  {
                    dataIndex: 'inveType',
                    title: '投资类型',
                    type: DATA_ENTRY.SELECT,
                    initialValue: baseInfo?.inveType || undefined,
                    dataSource: dictMapSelect.BAXX_TZLX,
                    disabled: editabled || modeType == '1',
                    rules: [{ required: true, message: '请选择投资类型' }],
                    allowClear: true,
                    // span:8
                  },
                  {
                    dataIndex: 'baxx_cpyzms',
                    title: '运作模式',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.BAXX_CPYZMS,
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    initialValue: baseInfo?.baxx_cpyzms || undefined,
                    // span:'8',
                    onChange: this.handleChangeCPYZMS,
                    rules: [{ required: true, message: '请选择运作模式' }],
                    // 【最短持有期限】【最短持有期后是否自由赎回】【是否现金管理类】，
                    // 和发行信息中的【开放模式】、【规律开放周期】、【其他规律开放周期】、【无规律开放说明】【首次开放周期起始日】
                    // 【节假日是否开放】【平均开放次数（年化）】【开放期业务】【开放期业务说明】状态
                  },
                  {
                    dataIndex: 'isDkProduct',
                    title: '是否为定开产品',
                    type: DATA_ENTRY.SELECT,
                    isTrueFalseJudge: true,
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    hide: !['03', '04', '06'].includes(cpyzms),
                    // initialValue: '0',
                    initialValue: baseInfo?.isDkProduct === 'true' ? '1' : '0',
                    onChange: (e) => {
                      // 1,0
                      let isDkProduct = '';
                      if (e === '1') {
                        isDkProduct = 'true';
                      } else {
                        isDkProduct = 'false';
                      }
                      this.setState({
                        isDkProduct,
                      });
                    },
                    rules: [{ required: true, message: '请选择是否为定开产品' }],
                    // span:'8',
                  },
                  {
                    dataIndex: 'openCycle',
                    type: DATA_ENTRY.SELECT,
                    title: '开放周期',
                    dataSource: [
                      {
                        title: '季度',
                        value: '1',
                      },
                      {
                        title: '半年',
                        value: '2',
                      },
                      {
                        title: '1年',
                        value: '3',
                      },
                      {
                        title: '2年',
                        value: '4',
                      },
                      {
                        title: '3年',
                        value: '5',
                      },
                      {
                        title: '5年',
                        value: '6',
                      },
                      {
                        title: '最短持有期内',
                        value: '7',
                      },
                    ],
                    hide: !['03', '04', '06'].includes(cpyzms),
                    rules: [{ required: isDkProduct == 'true', message: '请选择开放周期' }],
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    initialValue: baseInfo?.openCycle || undefined,
                    onChange: (e) => {
                      const openCycle = e;
                      this.setState(
                        {
                          openCycle,
                          // isDkProduct: e === '7' ? 'true' : isDkProduct,
                        },
                        // () => {
                        //   e === '7' &&
                        //     this.inves.props.form.setFieldsValue({
                        //       isDkProduct: '1',
                        //     });
                        // },
                      );
                    },
                  },
                  {
                    dataIndex: 'baxx_cpmjfs',
                    title: '募集方式',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.BAXX_CPMJFS,
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    initialValue: baseInfo?.baxx_cpmjfs || undefined,
                    rules: [{ required: true, message: '请选择募集方式' }],
                    // span:'8',
                  },
                  {
                    dataIndex: 'limits',
                    title: '产品期限',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.ZGTZPT_PRODUCY_INFO_LIMIT,
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    initialValue: baseInfo?.limits || undefined,
                    rules: [{ required: true, message: '请选择产品期限' }],
                    // span:'8',
                  },
                  {
                    dataIndex: 'valuationMethod',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.PRODUCT_VALUATIONMETHOD_DIC,
                    title: '估值方式',
                    initialValue: baseInfo?.valuationMethod || undefined,
                    disabled: editabled || modeType == '1',
                    rules: [{ required: true, message: '请选择估值方式' }],
                    // span:8
                  },
                  {
                    dataIndex: 'isInvestmentAdviser',
                    type: DATA_ENTRY.SELECT,
                    title: '是否聘用投顾',
                    dataSource: [
                      { value: 'false', title: '否' },
                      { value: 'true', title: '是' },
                    ],
                    initialValue: baseInfo?.isInvestmentAdviser || 'false',
                    disabled: editabled || modeType == '1',
                    rules: [{ required: true, message: '请选择' }],
                  },
                  {
                    dataIndex: 'isCurrencyFund',
                    title: '是否为货币基金',
                    type: DATA_ENTRY.SELECT,
                    initialValue: baseInfo?.isCurrencyFund, // 备案
                    allowClear: true,
                    disabled: editabled || modeType == '1',
                    isTrueFalseJudge: true,
                    rules: [{ required: true, message: '请选择货币基金' }],
                    // span:8
                  },
                  {
                    dataIndex: 'manageType',
                    type: DATA_ENTRY.SELECT,
                    title: '管理方式',
                    dataSource: dictMapSelect.baxx_manageType,
                    initialValue: baseInfo?.manageType || '0',
                    disabled: editabled || modeType == '1',
                    allowClear: true,
                    rules: [{ required: true, message: '请选择' }],
                  },
                  {
                    dataIndex: 'standardRate',
                    type: DATA_ENTRY.BENCHMARK,
                    title: '业绩比较基准',
                    initialValue: baseInfo?.standardRate || undefined,
                    disabled: editabled,
                    // span:8
                  },
                  {
                    dataIndex: 'baxx_cpfxdj',
                    title: '产品风险等级',
                    type: DATA_ENTRY.SELECT,
                    dataSource: dictMapSelect.BAXX_CPFXDJ,
                    allowClear: true,
                    disabled: editabled,
                    initialValue: baseInfo?.baxx_cpfxdj || undefined,
                    // span:'8',
                  },
                  {
                    dataIndex: 'productGroupIds',
                    title: '所属产品组',
                    type: DATA_ENTRY.SELECT,
                    onRef: (ref) => {
                      this.productGroupIdsRef = ref;
                    },
                    // TODO
                    dataSource: options, // 直接传入所有的dataSource
                    getPopupContainer: () => document.getElementById('container'),
                    onChange: (e) => {
                      const productGroupIds = [];
                      e.map((item) => {
                        productGroupIds.push(item);
                      });
                      // 选中之后自动清空筛选值但是不会走onSearch方法，所以这里要手动刷新一下dataSource并重新赋值tooltip
                      // this.getOptions(_, () => this.productGroupIdsRef.setSelect(productGroupIds));
                      this.setState({
                        productGroupIds,
                      });
                    },
                    // onSearch: (name) => {
                    //   // this.setState(() => {
                    //   this.getOptions(name);
                    //   // });
                    // },
                    showSearch: true,
                    allowClear: true,
                    disabled: editabled,
                    initialValue: (baseInfo?.productGroup || []).map((i) => i.id) || [],
                    isMultiple: true,
                    positionBody: true,
                    filterOption: (inputValue, option) => option.children.includes(inputValue),
                  },
                ]}
                autoLayout={true}
              />
              <div className={styles.line}></div>
              <SecondHeaderC title='运营信息' />
              <FormGroup
                widthSet={this.props.widthSet}
                onRef={(ref) => (this.perform = ref)}
                dataSource={
                  modesValue == 'VALUATION_BOOKKEEPING_MODEL' || modesValue == 'VALUATION_TABLE_ANALYSIS_MODE'
                    ? [
                        {
                          dataIndex: 'modes',
                          title: '交易模式',
                          type: DATA_ENTRY.SELECT,
                          dataSource: list,
                          allowClear: true,
                          disabled: editabled,
                          initialValue: baseInfo?.modes || undefined,
                          rules: [{ required: true, message: '请选择交易模式' }],
                          onChange: this.changeModes,
                          // span:'8',
                        },
                        {
                          dataIndex: 'verificationModeTa',
                          title: 'TA申赎处理方式',
                          type: DATA_ENTRY.SELECT,
                          dataSource: dictMapSelect.TA_APPLICATION_AND_SETTLEMENT_METHOD,
                          disabled: editabled,
                          initialValue: baseInfo?.verificationModeTa,
                          allowClear: true,
                          rules: [{ required: true, message: '请选择TA申赎处理方式' }],
                          // span:8
                        },
                      ]
                    : [
                        {
                          dataIndex: 'modes',
                          title: '交易模式',
                          type: DATA_ENTRY.SELECT,
                          dataSource: list,
                          allowClear: true,
                          disabled: editabled,
                          initialValue: baseInfo?.modes || undefined,
                          rules: [{ required: true, message: '请选择交易模式' }],
                          onChange: this.changeModes,
                          // span:'8',
                        },
                        {
                          dataIndex: 'verificationModeGz',
                          title: '估值核对方式',
                          type: DATA_ENTRY.SELECT,
                          dataSource: dictMapSelect.PRODUCT_VERIFICATIONMODE_DICT,
                          disabled: editabled,
                          initialValue: baseInfo?.verificationModeGz,
                          allowClear: true,
                          rules: [{ required: true, message: '请选择估值核对方式' }],
                          // span:8
                        },
                        {
                          dataIndex: 'verificationModeTa',
                          title: 'TA申赎处理方式',
                          type: DATA_ENTRY.SELECT,
                          dataSource: dictMapSelect.TA_APPLICATION_AND_SETTLEMENT_METHOD,
                          disabled: editabled,
                          initialValue: baseInfo?.verificationModeTa,
                          allowClear: true,
                          rules: [{ required: true, message: '请选择TA申赎处理方式' }],
                          // span:8
                        },
                      ]
                }
                autoLayout={true}
              />
              <div className={styles.line}></div>
              <div className={styles.line}></div>
              <SecondHeaderC title='账户信息' arrowBtn={true} showContent={showExpend} onExpendClick={this.onExpendClick} />
              {showExpend ? (
                <div>
                  <div>
                    <ThreeHeaderC title='证券户' />
                    {getFieldDecorator('accountList2', {
                      initialValue: baseInfo?.accountList2 || [],
                    })(<AccountList type='2' {...listProps} />)}
                  </div>
                  <div style={{ marginTop: '16px' }}>
                    <ThreeHeaderC title='资金户' />
                    {getFieldDecorator('accountList1', {
                      initialValue: baseInfo?.accountList1 || [],
                    })(<AccountList type='1' {...listProps} />)}
                  </div>
                  <div style={{ marginTop: '16px', marginBottom: '16px' }}>
                    <ThreeHeaderC title='托管户' />
                    {getFieldDecorator('accountList0', {
                      initialValue: baseInfo?.accountList0 || [],
                    })(<AccountList type='0' {...listProps} />)}
                  </div>
                </div>
              ) : (
                ''
              )}
            </div>
          }
          bottomHtml={
            <div className={styles.borderLine}>
              <PrimaryGhostC title={'取消'} onClick={this.cancel} />
              {!editabled ? <PrimaryC title={'保存'} onClick={this.save} loading={loading} /> : ''}
            </div>
          }
        />
      </div>
    );
  }
}
export default connect(({ userM: user, productManageM, loading }) => ({
  currentUser: user.currentUser,
  productManageM,
  loading: loading.effects['productManageM/saveFn'],
}))(BaseInfo);
